home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / c / bc_pas_1.zip / RECFILE.C < prev    next >
C/C++ Source or Header  |  1992-10-06  |  19KB  |  870 lines

  1. /*$Author:   DCODY  $*/
  2. /*$Date:   06 Oct 1992 15:21:10  $*/
  3. /*$Header:   X:/sccs/pcmapps/recfile.c_v   1.12   06 Oct 1992 15:21:10   DCODY  $*/
  4. /*$Log:   X:/sccs/pcmapps/recfile.c_v  $
  5.  * 
  6.  *    Rev 1.12   06 Oct 1992 15:21:10   DCODY
  7.  * corrected a bug in writing the RIFF data size
  8.  * 
  9.  *    Rev 1.11   24 Sep 1992 08:59:04   DCODY
  10.  * changed MVGetHardware to mvGetHardware
  11.  * 
  12.  *    Rev 1.10   18 Sep 1992 08:47:58   DCODY
  13.  * added '+' option to the 'M' switch.
  14.  * 
  15.  *    Rev 1.9   14 Sep 1992 17:23:50   SHAO_M
  16.  * Put all the text strings used in printf into rectext.h
  17.  * 
  18.  *    Rev 1.0   14 Sep 1992 17:02:20   unknown
  19.  * Initial revision.
  20.  * 
  21.  *    Rev 1.8   02 Sep 1992 12:48:52   DCODY
  22.  * made one simple change that now allows 44khz stereo 16bit recordings.
  23.  * Took out the writting of the WAV header before starting the record
  24.  * process. It is now done after the recording is finished. This allows
  25.  * the data blocks to be written on sector boundaries.
  26.  * 
  27.  *    Rev 1.7   20 Aug 1992 14:36:28   DCODY
  28.  * error exit now reports proper T&L product name.
  29.  * 
  30.  *    Rev 1.6   04 Aug 1992 11:39:42   DCODY
  31.  * corrected t&l spelling
  32.  * 
  33.  *    Rev 1.5   28 Jul 1992 14:29:30   DCODY
  34.  * updated for Thunderboard and Thunder&Lightning
  35.  * 
  36.  *    Rev 1.4   20 Jul 1992 11:39:18   DCODY
  37.  * call to mvGetHWVersion now uses active I/O address detection.
  38.  * 
  39.  *    Rev 1.3   13 Jul 1992 18:54:00   DCODY
  40.  * removed initmvsound call
  41.  * 
  42.  *    Rev 1.2   01 Jul 1992 11:57:16   DCODY
  43.  * GaryL: Added OEM compiler flag checking for Welcome()
  44.  * to use the generic board name and to not displau the MVI copyright.
  45.  * Note that the copyright is still present, as an imbedded static string.
  46.  * 
  47.  *    Rev 1.1   23 Jun 1992 16:10:02   DCODY
  48.  * pas2 update...
  49.  * 
  50.  *    Rev 1.0   15 Jun 1992 09:26:48   BCRANE
  51.  * Initial revision.
  52. */
  53. /*$Logfile:   X:/sccs/pcmapps/recfile.c_v  $*/
  54. /*$Modtimes$*/
  55. /*$Revision:   1.12  $*/
  56. /*$Workfile:   recfile.c  $*/
  57.  
  58.  
  59.     /*\
  60.     |*|----====< RECFILE.C >====----
  61.     |*|
  62.     |*| Record 8 bit PCM to disk in .WAV format
  63.     |*|
  64.     |*| Copyright (c) 1991, Media Vision, Inc. All rights reserved.
  65.     |*|
  66.     \*/
  67.  
  68. #ifndef OEM
  69. #define OEM 0
  70. #endif
  71.  
  72. #ifndef PROAS
  73. #define PROAS 0
  74. #endif
  75.  
  76. #ifndef THUNDER
  77. #define THUNDER 0
  78. #endif
  79.  
  80. #include <stdio.h>
  81. #include <stdlib.h>
  82. #include <malloc.h>
  83. #include <signal.h>
  84. #include "rectext.h"
  85.  
  86.  
  87. #if PROAS
  88. #include "play.h"
  89. #include "common.h"
  90. #include "pcmio.h"
  91. #include "binary.h"
  92. #endif
  93.  
  94. #if THUNDER
  95. #include "proto.h"
  96. #include "play.h"
  97. #include "common.h"
  98. #include "pcmio.h"
  99. #endif
  100.  
  101.  
  102.     /*\
  103.     |*|----====< Global Variables >====----
  104.     \*/
  105.  
  106.         extern int ProcessedBlockCount;
  107.  
  108.         long mvGetHWVersion (int);
  109.  
  110.  
  111.     /*\
  112.     |*|----====< Local Variables >====----
  113.     \*/
  114.  
  115.         static FILE *ouf = 0;           /* temp output file             */
  116.  
  117.         static long SampleRate = 11025L;/* default sample rate          */
  118.         static int  StereoMono = 0;     /* default to mono              */
  119.  
  120.         static char TargetFile[100];    /* holds output file name       */
  121.         static int    FilterIndex = -1;    /* -1 means no override         */
  122.  
  123.         static int    DMAChannel = -1;    /* default to standard DMA        */
  124.         static int    IRQChannel = -1;    /* default to standard IRQ        */
  125.  
  126.         static int    DebugFlag = FALSE;
  127.         static int    Compression = 0;        /* no compression - 8 bits    */
  128.  
  129.         static int  VoiceActivated = FALSE;
  130.         static int    VoiceActivatedNonStop = FALSE;
  131.         static int    NoiseLevel = 5;
  132.  
  133.         static int    maxsize = 16;        /* 16k DMA buffer size            */
  134.         static int    maxdiv    = 4;        /* 4k divisions on the DMA        */
  135.         static int    datasize= 8;        /* 8 or 16 bit samples            */
  136.  
  137. #define WAVEFILE    1
  138. #define VOCFILE     2
  139.         static int    FileType;
  140.  
  141.     /*\
  142.     |*|----====< Data Structures >====----
  143.     \*/
  144.  
  145.         RiffWave fhd = {
  146.             { "RIFF", 0L },
  147.             { "WAVE",
  148.                 { "fmt ", sizeof(WaveInfo) , { 1, 1, 11025L, 11025L, 1, 8}, },
  149.                 { "data", 0L },
  150.             }
  151.         };
  152.  
  153.     /* .VOC simple (cheat) header definition                            */
  154.  
  155.         typedef struct {
  156.             VOCHDR     vhdr;
  157.             bVOCDATA vdta;
  158.         } VOCHeader;
  159.  
  160.     /* our pre-defined data block                                        */
  161.  
  162.         static VOCHeader vhd = {
  163.             { "Creative Voice File\x1a", 0x001a, 0x010a, 0x1129 },
  164.             { 0x01, 0x0,0x0,0x0, 0xa5, 0x0 }
  165.         };
  166.  
  167.  
  168.     /*\
  169.     |*|-----------------=============================-------------------
  170.     |*|-----------------====< Start of Exection >====-------------------
  171.     |*|-----------------=============================-------------------
  172.     \*/
  173.  
  174.     /*\
  175.     |*|----====< Main >====----
  176.     |*|
  177.     |*| Play the voice file out to the PCM hardware
  178.     |*|
  179.     \*/
  180.  
  181. main(argc,argv)
  182.     int  argc;
  183.     char *argv[];
  184. {
  185. char c;
  186.  
  187.     /* Give the welcome & checkout the hardware                         */
  188.  
  189.         Welcome();
  190.  
  191.     /* disable the ^C                                                   */
  192.  
  193.         signal(SIGINT,SIG_IGN);
  194.  
  195.     /* set the runtime switches                                         */
  196.  
  197.         CommandLine (argc,argv);
  198.  
  199.     /* need a file name to play, exit if not found                      */
  200.  
  201.         PreProcessFile (TargetFile);
  202.  
  203. #if THUNDER
  204.     /* last minute weirdness check...                                    */
  205.  
  206.         LastChanceStop();
  207. #endif
  208.  
  209. #if PROAS
  210.     /* turn off the digital input mixer channel to avoid feedback       */
  211.  
  212.         TurnItOff();
  213.  
  214. #endif
  215.  
  216.     /* setup the DMA operations                                         */
  217.  
  218.         if (OpenPCMBuffering(DMAChannel,IRQChannel,maxsize,maxdiv)) {
  219.             printf (TXT_MSG1);
  220.             DoExit (-1);
  221.         }
  222.  
  223.     /* setup how this file sounds                                        */
  224.  
  225. #if PROAS
  226.         ChooseFilter( SampleRate, FilterIndex );
  227. #endif
  228.  
  229.         PCMState (SampleRate, StereoMono, Compression, datasize);
  230.  
  231.     /* Start the DMA & wait till an ESC is typed or data ends           */
  232.  
  233.         printf (TXT_MSG2);
  234.  
  235.         if (StartFileInput( ouf )) {
  236.  
  237.             while (1) {
  238.  
  239.                 /* process some PCM data, if available                    */
  240.  
  241.                     if (VoiceActivated) {
  242.                         if (!ASpecialContinueFileInput(NoiseLevel,VoiceActivatedNonStop))
  243.                             DoExit(PCMIOERR_FILEFULL);
  244.                     }
  245.                     else {
  246.                         if (!ContinueFileInput())
  247.                             DoExit(PCMIOERR_FILEFULL);
  248.                     }
  249.  
  250.                 /* if ESC typed, kill the DMA & exit                    */
  251.  
  252.                     if (kbhit()) {
  253.                         if ((c = getch()) == 0x1b) {
  254.                             StopDMAIO();
  255.                             break;
  256.                         }
  257.                         if (c == ' ') {
  258.                             PausePCM();
  259.                             printf (TXT_MSG3);
  260.                             GetKey();
  261.                             printf (TXT_MSG4);
  262.                             ResumePCM();
  263.                         }
  264.                     }
  265.             }
  266.         }
  267.         else
  268.             DoExit (PCMIOERR_OPENPCM);
  269.  
  270.     /* exit to DOS                                                      */
  271.  
  272.         DoExit(0);
  273.  
  274. }
  275.  
  276.     /*\
  277.     |*|--------------------=======================----------------------
  278.     |*|--------------------====< Subroutines >====----------------------
  279.     |*|--------------------=======================----------------------
  280.     \*/
  281.  
  282.  
  283.     /*\
  284.     |*|----====< BuildFileName( char *, char *, char *, int ); >====----
  285.     |*|
  286.     |*| This routine takes the source name, scans it for an extension,
  287.     |*| then may append the new extension. The entire file name is
  288.     |*| returned in the callers target string.
  289.     |*|
  290.     \*/
  291. void BuildFileName(trg,src,ext,force)
  292.     char *trg;
  293.     char *src;
  294.     char *ext;
  295.     int force;
  296. {
  297. int n;
  298. char *t,*o;
  299.  
  300.     // save a copy of the starting target address
  301.  
  302.         o = trg;
  303.  
  304.     // copy the source over to the target
  305.  
  306.         while ((*trg++ = *src++)) ;
  307.  
  308.     // move back to the terminator and save the pointer
  309.  
  310.         t = --trg;
  311.  
  312.     // search for an extension, if found, just return, we're all done...
  313.  
  314.         for (n=0;n<=4;n++) {
  315.  
  316.             // if no extension, go add one...
  317.  
  318.             if (o == trg)
  319.                 break;
  320.  
  321.             // if an extension...
  322.  
  323.             if (*trg == '.') {
  324.  
  325.                 // and do not force it, just return.
  326.  
  327.                 if (!force)
  328.                     return;
  329.  
  330.                 // else point to this extension, and break out...
  331.  
  332.                 else {
  333.                     t = trg;
  334.                     break;
  335.                 }
  336.             }
  337.  
  338.             // move back to the prior character
  339.  
  340.             trg--;
  341.         }
  342.  
  343.     // add the extension
  344.  
  345.         strcpy (t,ext);
  346.  
  347. }
  348.  
  349.  
  350.     /*\
  351.     |*|----====< CommandLine >====----
  352.     |*|
  353.     |*| process the command line switches
  354.     |*|
  355.     \*/
  356. int CommandLine(argc,argv)
  357.     int argc;
  358.     char *argv[];
  359. {
  360. char *s;
  361. int n,temp;
  362. long l;
  363.  
  364.     /* exit if no additional parameters                                 */
  365.  
  366.         if (argc < 2) {
  367.             GiveHelps();
  368.             DoExit(-1);
  369.         }
  370.  
  371.         n = 2;
  372.         while (n < argc) {
  373.  
  374.             s = argv[n++];
  375.  
  376.             if (*s == '/') s++;
  377.             if (*s == '-') s++;
  378.  
  379.             switch (*s & 0x5f) {
  380.  
  381. #if THUNDER
  382.                 case 'C':
  383.                     Compression = 01;    /* 4 bit compression            */
  384.                     break;
  385. #endif
  386.  
  387. #if PROAS
  388.                 case '8' & 0x5f:
  389.                 case '1' & 0x5f:
  390.                     if (*++s == '6')
  391.                         datasize = 16;
  392.                     break;
  393.  
  394.                 case 'F':
  395.                     FilterIndex = *++s - 0x30;
  396.                     if ((FilterIndex<0) || (FilterIndex>6))
  397.                         FilterIndex = -1;
  398.                     break;
  399. #endif
  400.  
  401.                 case 'D':
  402.                     temp = *++s - 0x30;
  403.                     if ((temp <= 7) && (temp >= 1)) {
  404.                         if (temp == 4) temp = 0;
  405.                         DMAChannel = temp;
  406.                     }
  407.                     break;
  408.  
  409.                 case 'I':
  410.                     if (sscanf (++s,"%d",&temp) == 1) {
  411.                         if ((1 << temp) & 0x9CBC)
  412.                             IRQChannel = temp;
  413.                     }
  414.                     break;
  415.  
  416.                 case 'M':
  417.                     maxsize = 64;
  418.                     maxdiv    = 16;
  419.                     if (*++s == '+')
  420.                         maxdiv    = 4;
  421.                     break;
  422.  
  423.                 case 'R':
  424.                     if (sscanf (++s,"%ld",&SampleRate) != 1) {
  425.                         printf (TXT_MSG5,s);
  426.                         SampleRate = 11025L;
  427.                     }
  428. #if PROAS
  429.                     if ((SampleRate < 4000L) || (SampleRate > 44100L)) {
  430.                         printf (TXT_MSG5,s);
  431.                         SampleRate = 11025L;
  432.                     }
  433. #endif
  434. #if THUNDER
  435.                     if ((SampleRate < 4000L) || (SampleRate > 23300L)) {
  436.                         printf (TXT_MSG5,s);
  437.                         SampleRate = 11025L;
  438.                     }
  439. #endif
  440.                     break;
  441.  
  442.                 case 'S':
  443.                     StereoMono = 1;
  444.                     break;
  445.  
  446.                 case 'V':
  447.                     VoiceActivated = TRUE;
  448.                     if (*(s+1) == '+') {
  449.                         VoiceActivatedNonStop = TRUE;
  450.                         s++;
  451.                     }
  452.                     if (sscanf (++s,"%d",&temp) == 1)
  453.                         NoiseLevel = temp;
  454.                     break;
  455.  
  456.                 case '+' & 0x5f:
  457.                     DebugFlag = TRUE;
  458.                     break;
  459.  
  460.                 default:
  461.                     break;
  462.             }
  463.         }
  464.  
  465.     /* determine the type of output file                                */
  466.  
  467.         BuildFileName (TargetFile,argv[1],".WAV",FALSE);
  468.  
  469.     /* scan the last portion of the name for the type                    */
  470.  
  471.         FileType = WAVEFILE;
  472.         s = TargetFile;
  473.         while (*s) s++;
  474.  
  475.         if ((*(s-1) & 0x5f) == 'C')
  476.             if ((*(s-2) & 0x5f) == 'O')
  477.                 if ((*(s-3) & 0x5f) == 'V')
  478.                     FileType = VOCFILE;
  479.  
  480.     /* if a bad sample rate, time to bomb out...                        */
  481.  
  482.         if (FileType == WAVEFILE) {
  483.             if ((SampleRate<<StereoMono) > 88200L) {
  484.                 printf (TXT_MSG6);
  485.                 DoExit(-1);
  486.             }
  487.         }
  488.         else {
  489.             if ((SampleRate<<StereoMono) > 23300L) {
  490.                 printf (TXT_MSG7,l);
  491.                 DoExit(-1);
  492.             }
  493.         }
  494. }
  495.  
  496.  
  497.     /*\
  498.     |*|----====< DoExit() >====----
  499.     |*|
  500.     |*| Exit to DOS
  501.     |*|
  502.     \*/
  503. int DoExit(cc)
  504.     int cc;
  505. {
  506.  
  507. #if PROAS
  508.     /* restore the PCM mixer channel                                    */
  509.  
  510.         TurnItOn();
  511. #endif
  512.  
  513.     /* print any error messages                                         */
  514.  
  515.         switch (cc) {
  516.  
  517.             case PCMIOERR_SAMPLERATE:
  518.                 printf (TXT_MSG8);
  519.                 break;
  520.  
  521.             case PCMIOERR_OPENFILE:
  522.                 printf (TXT_MSG9);
  523.                 break;
  524.  
  525.             case PCMIOERR_OPENPCM:
  526.                 printf (TXT_MSG10);
  527.                 break;
  528.  
  529.             case PCMIOERR_NOMEM:
  530.                 printf (TXT_MSG11);
  531.                 break;
  532.  
  533.             case PCMIOERR_BADDMA:
  534.                 printf (TXT_MSG12);
  535.                 break;
  536.  
  537.             case PCMIOERR_BADIRQ:
  538.                 printf (TXT_MSG13);
  539.                 break;
  540.  
  541.             case PCMIOERR_FILEFULL:
  542.                 printf (TXT_MSG14);
  543.                 printf (TXT_MSG15);
  544.                 break;
  545.  
  546.             default:
  547.             case PCMIOERR_HELPS:
  548.                 break;
  549.         }
  550.  
  551.     /* if there is data, flush it and zip up the file                    */
  552.  
  553.         if (ouf) {
  554.             if (ProcessedBlockCount) {
  555.                 if (FileType == VOCFILE)
  556.                     fputc (0x00,ouf);    /* set the terminating record    */
  557.                 fclose (ouf);
  558.                 if ((ouf = fopen(TargetFile,"r+b")) == 0) {
  559.                     printf (TXT_MSG16,TargetFile);
  560.                     ClosePCMBuffering();
  561.                     exit(cc);
  562.                 }
  563.                 SetupHeader();
  564.                 WriteBlockHeader();
  565.             }
  566.             fclose (ouf);
  567.         }
  568.  
  569.     /* shut down the hardware                                           */
  570.  
  571.         ClosePCMBuffering();
  572.         exit (cc);
  573. }
  574.  
  575.  
  576.     /*\
  577.     |*|----====< GetKey() >====----
  578.     |*|
  579.     |*| Get a new key
  580.     |*|
  581.     \*/
  582. int GetKey()
  583. {
  584. char c;
  585.  
  586.     while (kbhit()) getch();
  587.  
  588.     while (!kbhit()) ;
  589.     if (getch() == 0) getch();
  590.  
  591. }
  592.  
  593.  
  594.     /*\
  595.     |*|----====< GiveHelps >====----
  596.     |*|
  597.     |*| Print the Help messages & returen
  598.     |*|
  599.     \*/
  600. int GiveHelps()
  601. {
  602.  
  603.     /* print & return...                                                */
  604.  
  605. #if PROAS
  606.         printf (TXT_MSG17);
  607.         printf (TXT_MSG18);
  608.         printf (TXT_MSG19);
  609.         printf (TXT_MSG20);
  610.         printf (TXT_MSG21);
  611.         printf (TXT_MSG22);
  612.         printf (TXT_MSG23);
  613.         printf (TXT_MSG24);
  614.         printf (TXT_MSG25);
  615.         printf (TXT_MSG26);
  616.         printf (TXT_MSG27);
  617.         printf (TXT_MSG28);
  618. #endif
  619. #if THUNDER
  620.         printf (TXT_MSG29);
  621.         printf (TXT_MSG30);
  622.         printf (TXT_MSG31);
  623.         printf (TXT_MSG32);
  624.  #if THUNDER==2
  625.         printf (TXT_MSG33);
  626.         printf (TXT_MSG34);
  627.  #else
  628.         printf (TXT_MSG35);
  629.  #endif
  630.         printf (TXT_MSG36);
  631.         printf (TXT_MSG37);
  632.         printf (TXT_MSG38);
  633.         printf (TXT_MSG39);
  634. #endif
  635. }
  636.  
  637. #if THUNDER
  638.     /*\
  639.     |*|----====< LastChanceStop() >====----
  640.     |*|
  641.     |*| Stop if there are some illegal setups
  642.     |*|
  643.     \*/
  644. LastChanceStop()
  645. {
  646.  
  647.     /* .WAV cannot support compression...                                */
  648.  
  649.         if ((FileType == WAVEFILE) && (Compression)) {
  650.             printf (TXT_MSG40);
  651.             GiveHelps();
  652.             DoExit(-1);
  653.         }
  654. }
  655. #endif
  656.  
  657.     /*\
  658.     |*|----====< PreProcessFile >====----
  659.     |*|
  660.     |*| Validate the User's output file & load the 1st header block
  661.     |*|
  662.     \*/
  663. int PreProcessFile (fn)
  664.     char *fn;
  665. {
  666.  
  667.     /* see if the file already exists                                   */
  668.  
  669.         if ((ouf = fopen(fn,"rb"))) {
  670.  
  671.             printf (TXT_MSG41,fn);
  672.  
  673.             while (!kbhit()) ;
  674.  
  675.             if ((getchar() & 0x5f) != 'Y') {
  676. #if PROAS
  677.                 TurnItOn();
  678. #endif
  679.                 exit(1);
  680.             }
  681.             fclose (ouf);
  682.         }
  683.  
  684.     /* attempt to open the users disk file                              */
  685.  
  686.         if ((ouf = fopen(fn,"wb")) == 0) {
  687.             printf (TXT_MSG42,fn);
  688.             DoExit (-1);
  689.         }
  690.  
  691.     /* send the header to disk                                          */
  692.  
  693. ////////WriteBlockHeader();
  694.  
  695. }
  696.  
  697.  
  698.     /*\
  699.     |*|----====< SetupHeader >====----
  700.     |*|
  701.     |*| Load the RIFF header with the critical data
  702.     |*|
  703.     \*/
  704. int SetupHeader()
  705. {
  706. long l,n;
  707.  
  708.     /* calculate the block size of each buffer division                 */
  709.  
  710.         n = maxsize / maxdiv * 1024;
  711.  
  712.     /* get the # of processed blocks                                    */
  713.  
  714.         l = LONG(ProcessedBlockCount) * n - sizeof(RiffWave);
  715.  
  716.     /* set the data size                                                */
  717.  
  718.         fhd.wave.data.length = l;
  719.  
  720.     /* set the RIFF length                                              */
  721.  
  722.         fhd.riff.length = l + sizeof(WaveHeader);
  723.  
  724.     /* set the length of the FORMAT block                               */
  725.  
  726.         fhd.wave.fmt.length = sizeof(WaveInfo);
  727.  
  728.     /* set up the sample rate, etc...                                   */
  729.  
  730.         fhd.wave.fmt.info.nChannels        = StereoMono + 1;
  731.         fhd.wave.fmt.info.nSamplesPerSec   = SampleRate;
  732.         fhd.wave.fmt.info.nAvgBytesPerSec  = (SampleRate << StereoMono) <<
  733.                                                 ((datasize == 8) ? 0 : 1);
  734.         fhd.wave.fmt.info.nBlockAlign       = (1 + ((datasize == 8) ? 0 : 1))
  735.                                                 << StereoMono;
  736.         fhd.wave.fmt.info.nBitsPerSample   = datasize;
  737.  
  738.     /* setup the .VOC header                                            */
  739.  
  740.         l += 2;     // .VOC wants a block length 2 bytes too long!
  741.  
  742.         vhd.vdta.bsize[0] = (char) (l       & 0xff);
  743.         vhd.vdta.bsize[1] = (char)((l>>8)  & 0xff);
  744.         vhd.vdta.bsize[2] = (char)((l>>16) & 0xff);
  745.         vhd.vdta.sampler  = (char)(256-(1000000L/SampleRate)) & 0xff;
  746.         vhd.vdta.packtype = Compression;
  747.  
  748.         if (StereoMono)
  749.             vhd.vdta.packtype = 5;
  750.  
  751. }
  752.  
  753.  
  754.     /*\
  755.     |*|----====< Welcome >====----
  756.     |*|
  757.     |*| Print the logo & check for the appropriate hardware
  758.     |*|
  759.     \*/
  760. Welcome()
  761. {
  762. long ver;
  763.  
  764.     /* give the normal stuff...                                         */
  765.  
  766. #if OEM
  767.  #if PROAS
  768.         printf (TXT_MSG43);
  769.         {
  770.                 static char    zsCopyright[] = "Copyright (c) 1991,1992 Media Vision, Inc. All Rights Reserved\n\n";
  771.         }
  772.  
  773.         ver = mvGetHWVersion(USE_ACTIVE_ADDR);/* get the version              */
  774.         if (ver == -1) {
  775.             printf (TXT_MSG44);
  776.             GiveHelps();
  777.             exit(-1);
  778.         }
  779.  #endif
  780.  
  781.  #if THUNDER
  782.         printf (TXT_MSG45);
  783.         {
  784.                 static char    zsCopyright[] = "Copyright (c) 1991,1992 Media Vision, Inc. All Rights Reserved\n\n";
  785.         }
  786.  
  787.         ver = InitMVHardware();         /* get the version, or something.. */
  788.         if ((ver < 0) || ((ver & 0xffff0000) != 0x00010000)) {
  789.             printf (TXT_MSG46);
  790.             GiveHelps();
  791.             exit(-1);
  792.         }
  793.  #endif
  794. #else    //OEM
  795.  #if PROAS
  796.         printf (TXT_MSG47);
  797.         printf (TXT_MSG48);
  798.  
  799.         ver = mvGetHWVersion(USE_ACTIVE_ADDR);/* get the version              */
  800.         if (ver == -1) {
  801.             printf (TXT_MSG49);
  802.             GiveHelps();
  803.             exit(-1);
  804.         }
  805.  #endif
  806.  
  807.  #if THUNDER
  808.   #if THUNDER==2
  809.         printf (TXT_MSG50);
  810.   #else
  811.         printf (TXT_MSG51);
  812.   #endif
  813.         printf (TXT_MSG52);
  814.  
  815.         ver = mvGetHWVersion(0);        /* get the version, or something.. */
  816.         if ((ver < 0) || ((ver & 0xffff0000) != 0x00010000)) {
  817.   #if THUNDER==2
  818.             printf (TXT_MSG53);
  819.   #else
  820.             printf (TXT_MSG54);
  821.   #endif
  822.             GiveHelps();
  823.             exit(-1);
  824.         }
  825.  #endif
  826. #endif    //OEM
  827.  
  828. }
  829.  
  830.  
  831.     /*\
  832.     |*|----====< WriteBlockHeader >====----
  833.     |*|
  834.     |*| Output the one and only voice block header
  835.     |*|
  836.     \*/
  837.  
  838. int WriteBlockHeader()
  839. {
  840. long l;
  841. char *s;
  842. int n;
  843. WaveFormat wf;
  844.  
  845.     /* point to the start of the file                                   */
  846.  
  847.         fseek (ouf,0L,SEEK_SET);
  848.  
  849.     /* depending on the type of file, output the data...                */
  850.  
  851.         if (FileType == WAVEFILE) {
  852.  
  853.             s = (char*) &fhd;
  854.             for (n=sizeof(RiffWave);n;n--)
  855.                 fputc(*s++,ouf);
  856.         }
  857.         else {
  858.  
  859.             s = (char*) &vhd;
  860.             for (n=sizeof(VOCHeader);n;n--)
  861.                 fputc(*s++,ouf);
  862.         }
  863. }
  864.  
  865.  
  866.     /*\
  867.     |*| end of RECFILE.C
  868.     \*/
  869.  
  870.